package com.lonely.web.controller.order;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.lonely.common.core.domain.api.R;
import com.lonely.order.domain.dto.split.SplitOrderDTO;
import com.lonely.order.service.IOrderSplitService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: 黄志标
 * @date: 2025/6/24 15:03
 * @description: 分单相关请求处理器
 */
@RestController
@RequestMapping("/orderManager/orderSplit")
@Api(tags = "订单管理/分单")
public class OrderSplitController {

    @Autowired
    private IOrderSplitService orderSplitService;

    /**
     * 分单
     *
     * @param splitOrderDTO
     * @return
     */
    @PostMapping("/splitOrders")
    @ApiOperation(value = "分单")
    @SaCheckPermission("order:followList:splitOrders")
    public R<Boolean> splitOrders(@RequestBody @Validated SplitOrderDTO splitOrderDTO) {
        this.orderSplitService.splitOrders(splitOrderDTO);
        return R.status(true);
    }

}
